package daily.oct;

public class lc1518 {
    public int numWaterBottles(int numBottles, int numExchange) {

        int res = numBottles;//总共喝水的数量

        while (numBottles >= numExchange) {
            int newBottles = numBottles / numExchange;
            int remainEmpty = numBottles % numExchange;
            numBottles = newBottles + remainEmpty;//总的空瓶子数量
            res = res + newBottles;
        }
        
        return res;
    }
    
    public static void main(String[] args) {
        lc1518 lc = new lc1518();
        System.out.println(lc.numWaterBottles(9, 3));
        System.out.println(lc.numWaterBottles(15, 4));
        // System.out.println(lc.numWaterBottles(5, 5));
        // System.out.println(lc.numWaterBottles(2, 3));
    }
}
